package com.itheima.utils;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author: 放学后海堤日记
 * @Date: 2023/4/13 22:57
 * @Desc: 将id封装在线程变量中，解决公共字段遗留问题
 */
@Slf4j
public class BaseContext {
    private static final ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void setCurrentId(Long id) {
//        log.info("BaseContext====================封装id===================");
//        log.info(String.valueOf(id));
        threadLocal.set(id);
    }

    public static Long getCurrentId() {
        return threadLocal.get();
    }
}
